package com.ruoyi.web.controller.app;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.wb.domain.WbPlanClassifyYearContentThree;
import com.ruoyi.wb.service.IWbPlanClassifyYearContentThreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 维保年度类三级Controller
 * 
 * @author ruoyi
 * @date 2024-11-15
 */
@RestController
@RequestMapping("/system/three")
public class WbAppPlanClassifyYearContentThreeController extends BaseController
{
    @Autowired
    private IWbPlanClassifyYearContentThreeService wbPlanClassifyYearContentThreeService;

    /**
     * 查询维保年度类三级列表
     */
    @GetMapping("/list")
    public TableDataInfo list(WbPlanClassifyYearContentThree wbPlanClassifyYearContentThree)
    {
        startPage();
        List<WbPlanClassifyYearContentThree> list = wbPlanClassifyYearContentThreeService.selectWbPlanClassifyYearContentThreeList(wbPlanClassifyYearContentThree);
        return getDataTable(list);
    }

    /**
     * 导出维保年度类三级列表
     */
    @Log(title = "维保年度类三级", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WbPlanClassifyYearContentThree wbPlanClassifyYearContentThree)
    {
        List<WbPlanClassifyYearContentThree> list = wbPlanClassifyYearContentThreeService.selectWbPlanClassifyYearContentThreeList(wbPlanClassifyYearContentThree);
        ExcelUtil<WbPlanClassifyYearContentThree> util = new ExcelUtil<WbPlanClassifyYearContentThree>(WbPlanClassifyYearContentThree.class);
        util.exportExcel(response, list, "维保年度类三级数据");
    }

    /**
     * 获取维保年度类三级详细信息
     */
    @GetMapping(value = "/{classifyContentId}")
    public AjaxResult getInfo(@PathVariable("classifyContentId") Long classifyContentId)
    {
        return success(wbPlanClassifyYearContentThreeService.selectWbPlanClassifyYearContentThreeByClassifyContentId(classifyContentId));
    }

    /**
     * 新增维保年度类三级
     */
    @Log(title = "维保年度类三级", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody WbPlanClassifyYearContentThree wbPlanClassifyYearContentThree)
    {
        return toAjax(wbPlanClassifyYearContentThreeService.insertWbPlanClassifyYearContentThree(wbPlanClassifyYearContentThree));
    }

    /**
     * 修改维保年度类三级
     */
    @Log(title = "维保年度类三级", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody WbPlanClassifyYearContentThree wbPlanClassifyYearContentThree)
    {
        return toAjax(wbPlanClassifyYearContentThreeService.updateWbPlanClassifyYearContentThree(wbPlanClassifyYearContentThree));
    }

    /**
     * 删除维保年度类三级
     */
    @Log(title = "维保年度类三级", businessType = BusinessType.DELETE)
	@DeleteMapping("/{classifyContentIds}")
    public AjaxResult remove(@PathVariable Long[] classifyContentIds)
    {
        return toAjax(wbPlanClassifyYearContentThreeService.deleteWbPlanClassifyYearContentThreeByClassifyContentIds(classifyContentIds));
    }

    /**
     * 批量新增维保年度类三级
     */
    @Log(title = "批量新增维保年度类三级", businessType = BusinessType.INSERT)
    @PostMapping("/batchAdd")
    public AjaxResult batchAdd(@RequestBody List<WbPlanClassifyYearContentThree> wbPlanClassifyYearContentThrees)
    {
        return toAjax(wbPlanClassifyYearContentThreeService.batchAdd(wbPlanClassifyYearContentThrees));
    }

    /**
     * 批量修改维保年度类三级
     */
    @Log(title = "维保年度类三级", businessType = BusinessType.UPDATE)
    @PutMapping("/batchEdit")
    public AjaxResult batchEdit(@RequestBody List<WbPlanClassifyYearContentThree> wbPlanClassifyYearContentThrees)
    {
        return toAjax(wbPlanClassifyYearContentThreeService.batchEdit(wbPlanClassifyYearContentThrees));
    }




}
